package net.siren93.smh.service.impl;

import net.siren93.smh.dao.TaskDao;
import net.siren93.smh.entity.TaskEntity;
import net.siren93.smh.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by siren93 on 15/10/12.
 */
@Repository("taskService")
public class TaskServiceImpl implements TaskService {

    @Autowired
    TaskDao taskDao;

    @Override
    public TaskEntity findByName(String name) {
        return taskDao.findByName(name);
    }

    @Override
    public TaskEntity findById(int id) {
        return taskDao.get(id);
    }

    @Override
    public List<TaskEntity> findByEmployee(int id, int page, int rows) {
        return taskDao.findByEmployee(id, page, rows);
    }

    @Override
    public List<TaskEntity> findByProject(int id, int page, int rows) {
        return taskDao.findByProject(id, page, rows);
    }

    @Override
    public List<TaskEntity> listTask() {
        return taskDao.findAll();
    }

    @Override
    public void saveOrUpdate(TaskEntity entity) {
        taskDao.saveOrUpdate(entity);
    }

    @Override
    public Integer save(TaskEntity entity) {
        return taskDao.save(entity);
    }

    @Override
    public void delById(int id) {
        taskDao.delete(id);
    }
}
